package com.springstudy.imports;


import com.springstudy.beans.OtherBean2;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

/**
 * @author Tamako
 * @since 2025/1/10 11:31
 */
public class MyImportBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar {
    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry, BeanNameGenerator importBeanNameGenerator) {
        //注册beanDefinition
        RootBeanDefinition beanDefinition = new RootBeanDefinition(OtherBean2.class);
        registry.registerBeanDefinition("otherBean2", beanDefinition);
    }
}
